package com.gitee.wsl.doc.rss

import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.Test

class ParseAtomTest {

    @Test
    fun validVersion() {
        val feed:RSSFeed = ParseRSS.parse(Feed.rssAtom)
        assertEquals(feed.version,RSSVersion.RSS_ATOM)
    }

    @Test
    fun validSimpleFeedAndItem() {
        val feed:RSSFeed = ParseRSS.parse(Feed.rssAtom)
        assertTrue(feed.title?.equals("dive into mark")==true)
        assertTrue(feed.items.size==2)
        assertTrue(feed.items[0].title?.equals("Atom draft-07 snapshot") == true)
        assertTrue(feed.items[1].title?.equals("Atom-Powered Robots Run Amok") ==true)
        assertTrue(feed.guId!!.value.equals("tag:example.org,2003:3"))
        assertTrue(feed.items[1].summary?.equals("Some text.") == true)
        assertTrue(feed.items[1].lastUpdated?.equals("2003-12-13T18:30:02Z")==true)
        assertTrue(feed.items[0].author!!.email?.equals("f8dy@example.com")==true)
    }
}